]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
texture-cache: Fall back to actor size for bound textures
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 8 Mar 2019 13:08:27 +0000 (14:08 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 8 Mar 2019 15:20:21 +0000 (16:20 +0100)
With StImageContent, the meaning of passing -1 as size parameter changed
from "load the image at its preferred size" to "abort the session". It
is therefore no longer possible to just load the image and then have it
scaled by applying a CSS size to the texture's parent.

Setting the size from CSS is useful though, so to still allow that, fall
back to the actor's size (which can be determined by the style).

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1027

src/st/st-texture-cache.c

index fa5b1f04a4e5545c8f0f9898422a1acdb5395656..61f76accc04535a42ba748b203f65f2052fb1f6a 100644 (file)
@@ -700,10 +700,14 @@ st_texture_cache_reset_texture (StTextureCachePropertyBind *bind,
     {
       g_autoptr(ClutterContent) image = NULL;
       g_autoptr(GError) error = NULL;
+      int size = bind->size;
+
+      if (size < 0)
+        clutter_actor_get_preferred_width (bind->actor, -1, NULL, (float *)&size);
 
       image = clutter_actor_get_content (bind->actor);
       if (!image || !CLUTTER_IS_IMAGE (image))
-        image = st_image_content_new_with_preferred_size (bind->size, bind->size);
+        image = st_image_content_new_with_preferred_size (size, size);
       else
         g_object_ref (image);